<?php
/**
 * Helper for print date.
 *
 * PHP versions 4 and 5
 *
 * @filesource
 * @copyright		Copyright 2007, MEC - Ministerio da educacao
 * @link			http://www.mec.gov.br
 * @package			cake
 * @subpackage		cake.app.view.helpers
 * @since			CakePHP(tm) v 0.1
 * @version			$Revision: 0.1 $
 * @modifiedby		$LastChangedBy: abdalacerqueira $
 * @lastmodified	$Date: 2007-04-16 14:49:05 -0600 (Thu, 16 Apr 2007) $
 */
/**
 * DateHelper library.
 *
 * @package		cake
 * @subpackage	cake.app.view.helpers
 */
class DateHelper extends Helper 
{
	/**
	 * Included helpers.
	 *
	 * @var array
	 * @access public
	 */
	var $helpers = array( 'Time' );
	
	function format( $date_string = null, $format = "d/m/Y" , $return = false , $returnNow = false ) 
	{
		if ( $date_string != null ) 
		{
			$date = $this->Time->fromString( $date_string );
			$ret = date( $format , $date );
			return $this->output( $ret , $return );
		}
		else 
		{
			if( $returnNow )
			{
				$date = time();
				$ret = date( $format , $date );
				return $this->output( $ret , $return );
			}
		}
	}
}

?>